﻿using UnityEngine;
using UnityEngine.UI;
public class VideoDialog : MonoBehaviour
{
    public float AlphaTet = 1f;
    public void OnEnable()
    {
        AlphaTet = 1f;
        Text textComponent = GetComponent<Text>();

        Color color = textComponent.color;
        color.a = AlphaTet; // 设置透明度
        textComponent.color = color;

    }
public void Update()
    {
        if (AlphaTet > 0)
        {
            AlphaTet -= Time.deltaTime /2f ;
            Text textComponent = GetComponent<Text>();
            Color color = textComponent.color;
            color.a = AlphaTet; // 设置透明度
            textComponent.color = color;
        }else if(AlphaTet <= 0)
        {
            gameObject.SetActive(false);
        }
    }
}
